<meta charset="UTF-8">
<style>

</style>
<div class="content-wrapper" style="min-height: 901px;">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1 style="text-align:center">
        	档口设置
      </h1>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-md-12">
          <div class="box">
          <div class="box-header">
          	<button class="btn btn-primary pull-left" data-toggle="modal" data-target="#newWindow"><i class="fa fa-plus"></i>&nbsp;&nbsp;新增档口</button>
          	&nbsp;
          	
          	<button class="btn pull-right" ng-click="download('tb_windows','档口列表')"><i class="fa fa-cloud-download"></i>&nbsp;&nbsp;导出</button>
          	<button class="btn pull-right" ng-click='openToggle()'>获取档口成本</button><!--ng-click="getWindowCost()"-->
          </div>
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                <tr>
                  <!--<th>
                  	<input type="checkbox" id="checkall" class="chk_1" name="selectall" ng-model="all"/>
						<label for="checkall" class="checklable"></label>全选
                  </th>-->
                  <th>序号</th>
                  <th>档口名称</th>
                  <th>档口主管</th>
                  <th>手机号</th>
                  <!--<th>主管编号</th>
                  <th>所属食堂编号</th>-->
                  <th>所属食堂</th>
                  <th style="width: 30%;">操作</th>
                </tr>
                <tr>
                	<td colspan="6" ng-if="dataWL == '0'">暂无数据</td>
                </tr>
                <tr ng-repeat="w in items">
                  <!--<td>
                  	<input type="checkbox" id="{{w.id}}" class="chk_1" name="checkwindows" ng-checked="all"/>
						<label for="{{w.id}}" class="checklable"></label>
                  </td>-->
                  <!--<td>{{w.id}}</td>-->
                  <td>{{$index+1}}</td>
                  <td>{{w.name}}</td>
                  <td>{{w.manager_name}}</td>
                  <td>{{w.manager_phone}}</td>
                  <!--<td>{{w.manager_id}}</td>
                  <td>{{w.canteen_id}}</td>-->
                  <td>{{w.canteen_name}}</td>
                  <td>
                  	<button class="btn btn-success" ng-click="showItems(w.id)">档口内产品</button>
                  	<button class="btn btn-info" ng-click="showwin_edit(w.id)">修改</button>
                  	<button class="btn btn-warning" ng-click="showwin_stop(w.id,'stop')" ng-show='w.is_enabled'>停用</button>
                  	<button class="btn btn-success" ng-click="showwin_stop(w.id,'open')" ng-hide='w.is_enabled'>启用</button>
                  	<button class="btn btn-danger" ng-click="showwin_del(w.id)">删除</button>
                  </td>
                </tr>
               </tbody>
			</table>
			<table class="table table-hover download" id="tb_windows" >
                <tbody>
                <tr>
                  <td>序号</td>
                  <td>档口名称</td>
                  <td>档口主管</td>
                  <td>手机号</td>
                  <!--<td>主管编号</td>
                  <td>所属食堂编号</th>-->
                  <td>所属食堂</td>
                </tr>
                <tr ng-repeat="w in windows">
                  <td>{{$index+1}}</td>
                  <td>{{w.name}}</td>
                  <td>{{w.manager_name}}</td>
                  <td>{{w.manager_phone}}</td>
                  <!--<td>{{w.manager_id}}</td>
                  <td>{{w.canteen_id}}</td>-->
                  <td>{{w.canteen_name}}</td>
                </tr>
               </tbody>
			</table>
            </div>
            <!-- /.box-body -->
           <div class="box-footer" style="margin-bottom:10px;">
	              	
	              		<div class="dataTables_info col-sm-2" id="example1_info" role="status" aria-live="polite">总条目数：{{totalNums}}</div>
	              	
	               
	                	
	                		<!--<label class="col-md-2" style="font-weight:normal;float:left;padding-right:15px;">每页显示数目 
	                			
	                		</label>
	                		<div class="col-md-2">
	                			
	                		
	                		<select name="example1_length" aria-controls="example1" class="form-control input-sm" ng-change="change(initial)" ng-model="initial" > 
	                				<option value="10">10</option> 
	                				<option value="25">25</option>
	                				<option value="50">50</option>
	                				<option value="100">100</option>
	                		    </select>
	                		</div>-->
	                		<div class="col-md-6 col-md-offset-4">
	                			<ul class="pagination pull-right" style="margin: 0px;">
		                			<li class="paginate_button previous" id="example1_previous">
		                				<a  ng-click="Previous()">上一页</a>
		                			</li>
		                			<li   ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}"><!-- class=" paginate_button active" -->
		                				<a  ng-click="selectPage(page)">{{page}}</a>
		                			</li>
		                			<li class="paginate_button next" id="example1_next">
		                				<a  ng-click="Next()">下一页</a>
		                			</li>
	                		</ul>
	                		</div>
	                		
	                	
	                
	              </div>
          </div>
          <!-- /.box -->
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
<!-- 删除档口modal  -->
  <div class="modal fade" id="delWindows" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
           	确定要删除所选档口吗？
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="del_windows();">确定</button>
      </div>
    </div>
  </div>
</div>
<!-- 档口内产品模态框  -->
  <div class="modal fade" id="items" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document" style="width:80%">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center;height: 55px;">档口内产品</h4>
      	<button class="btn pull-right" ng-click="download('tb_itemsInWindow','档口内产品表')"><i class="fa fa-cloud-download"></i>&nbsp;&nbsp;导出</button>
      	<div class="input-group col-md-6 pull-left">
                <input type="text" class="form-control" ng-model="searchItemInWindow" placeholder="请输入菜品名">
                    <span class="input-group-btn">
                      <button type="button" class="btn btn-flat"><i class="fa fa-search"></i>&nbsp;&nbsp;查找</button>
                    </span>
                </div>
      </div>
      <div class="modal-body form-horizontal">
       <div class="box-body">
          <div class="row"> <!-- 300  -->
           <div class="col-md-12">
              	
            
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="height: 300px;overflow: auto;">
              <table class="table table-hover" >
              	<thead>
                <tr>
                  <th>编号</th> 
                  <th>名称</th>
                  <th>单位</th>
                  <th>价格</th>
                 <!-- <th>厨师编号</th>-->
                  <th>厨师姓名</th>
                  <th>状态</th>
                </tr>
               </thead>
               <tbody >
                <tr ng-repeat="item in windowItems" >
                  <!--<td>{{item.id}}</td>-->
                  <td>{{$index+1}}</td>
                  <td>{{item.name}}</td>
                  <td>{{item.unit}}</td> 
                  <td>{{item.price}}</td>
                  <!--<td>{{item.chief_id}}</td>-->
                  <td>{{item.chief_name}}</td>
                  <td ng-bind="item.status=true?'启用':'停用'">{{item.status}}</td>
                </tr>
                
               </tbody>
              </table>
              <table class="table table-hover download" id="tb_itemsInWindow" style="visibility: collapse;">
                <tbody>
                <tr>
                  <td>编号</td> 
                  <td>名称</td>
                  <td>单位</td>
                  <td>内部价格</td>
                  <td>外部价格</td>
                  <td>厨师编号</td>
                  <td>厨师姓名</td>
                  <td>状态</td>
                </tr>
                <tr ng-repeat="item in windowItems" style="z-index: -999;position: fixed;">
                  <td>{{$index+1}}</td>
                  <td>{{item.name}}</td>
                  <td>{{item.unit}}</td> 
                  <td>{{item.in_price}}</td>
                  <td>{{item.out_price}}</td>
                  <td>{{item.chief_id}}</td>
                  <td>{{item.chief_name}}</td>
                  <td ng-bind="item.status=true?'启用':'停用'">{{item.status}}</td>
                </tr>
               </tbody>
              </table>
            </div>
            <!-- /.box-body -->
           </div>
            <!-- /.col -->
          </div>
          <!-- /.row -->
        </div>
        <!-- /.box-body -->
      
        </div>
      
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg col-md-4 col-md-offset-4" data-dismiss="modal">确定</button>
      </div>
    </div>
  </div>
</div>

<!-- 停用档口模态框 -->
<div class="modal fade" id="stopWindows" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
           	确定要停用所选档口吗？
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="stop_windows();">确定</button>
      </div>
    </div>
  </div>
</div>
<!-- 添加档口模态框 -->
<div class="modal fade" id="newWindow" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document" id="newWindowContent">
  	<form>
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center">新增档口</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">档口名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" placeholder="档口名称" ng-model="newWindow.name" ng-required='true' maxlength="12">
                        </div>
                    </div>
                    <!--<div class="form-group">
                        <label class="col-sm-3 control-label">档口主管编号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" placeholder="档口主管编号" ng-model="newWindow.manager_id" text-transform ng-required='true'>
                        </div>
                    </div>-->
                    <div class="form-group">
                    	<label class="col-sm-3 control-label">档口主管编号</label>
	                    <div class="col-sm-9">
			                <select class="form-control select2" style="width: 100%;" tabindex="-1" aria-hidden="true" ng-change='getPhone(newWindow.manager_id)' ng-model="newWindow.manager_id">
			                  <option value="0">---请选择主管---</option>
			                  <option ng-repeat='m in managers' value='{{m.id}}'>{{m.name}}</option>
			                </select>
			            </div>
                	</div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">档口主管手机号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" placeholder="档口主管手机号" ng-model="newWindow.manager_phone" maxlength="11" readonly="readonly">
                        </div>
                    </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="submit" class="btn btn-success btn-lg" ng-click="saveNewWindow();">保存</button>
      </div>
    </div>
    </form>
  </div>
</div>
<!-- 修改档口模态框 -->
<div class="modal fade" id="editWindow" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" ng-click="showwin_edit(win.id)"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center">修改档口</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">档口名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" ng-model="win.name" maxlength="12">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">档口主管编号</label>
                        <div class="col-sm-9">
                           <!-- <input type="text" class="form-control" ng-model="win.manager_id">-->
                        	<select class="form-control select2" style="width: 100%;" tabindex="-1" aria-hidden="true" ng-model="win.manager_id"  ng-change='getPhone(win.manager_id,"edit")'>
			                  <option value="0">---请选择主管---</option>
			                  <option ng-repeat='m in managers' value='{{m.id}}'>{{m.name}}</option>
			                </select>
			            
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">档口主管手机号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" ng-model="win.manager_phone" readonly="readonly">
                        </div>
                    </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" ng-click="showwin_edit(win.id)">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="saveWindow();">保存</button>
      </div>
    </div>
  </div>
</div>

<!-- 获取档口成本模态框 -->
<div class="modal fade" id="getWindowCost" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" ng-click='hideWindowCost()'><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel" style="text-align:center">选择获取成本时间</h4>
      </div>
      <div class="modal-body form-horizontal">
      		<div class="box-body">
      			
      			<label style='float: left; margin-right: 20px;margin-top: 5px;'>选择要获取档口成本的日期:</label>
      			 <div class="form-group col-lg-2 col-xs-6 space" style='width: 130px;padding-right: 0px;'>
					<div class="input-group date">
					  <input type="text" class="form-control pull-right" id="datepicker" readonly="">
					</div>
				</div>
      		</div>	
      </div>
     
      
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" ng-click="hideWindowCost()">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="saveWindowCost()">确定</button>
      </div>
    </div>
  </div>
</div>
